package org.eclipse.iota.rewrite;

import org.eclipse.iota.model.Addition;
import org.eclipse.iota.model.Alternation;
import org.eclipse.iota.model.BinaryOperation;
import org.eclipse.iota.model.Boolean;
import org.eclipse.iota.model.Clause;
import org.eclipse.iota.model.Constant;
import org.eclipse.iota.model.Constraint;
import org.eclipse.iota.model.Division;
import org.eclipse.iota.model.Element;
import org.eclipse.iota.model.Equation;
import org.eclipse.iota.model.Existential;
import org.eclipse.iota.model.Exponentiation;
import org.eclipse.iota.model.Expression;
import org.eclipse.iota.model.Inclusion;
import org.eclipse.iota.model.MultiOperation;
import org.eclipse.iota.model.Multiplication;
import org.eclipse.iota.model.Negation;
import org.eclipse.iota.model.Operation;
import org.eclipse.iota.model.Parameter;
import org.eclipse.iota.model.Property;
import org.eclipse.iota.model.Reference;
import org.eclipse.iota.model.UnaryOperation;
import org.eclipse.iota.model.Variable;

/**
 * Abstract rule implementation.
 * @author Christian Krause
 * @generated NOT
 */
public abstract class AbstractIotaRule implements IotaRule {

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.iota.IotaRule#getName()
	 */
	public String getName() {
		return getClass().getSimpleName();
	}

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.iota.IotaRule#getPriority()
	 */
	public int getPriority() {
		return PRIORITY_NORMAL;
	}

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.iota.rewrite.IotaRule#apply(org.eclipse.iota.model.Element, boolean)
	 */
	@Override
	public boolean apply(Element element, boolean change) {
		if (element instanceof Property) return apply((Property) element, change);
		if (element instanceof Alternation) return apply((Alternation) element, change);
		if (element instanceof Clause) return apply((Clause) element, change);
		if (element instanceof Constraint) return apply((Constraint) element, change);
		if (element instanceof Expression) return apply((Expression) element, change);
		if (element instanceof Variable) return apply((Variable) element, change);
		return false;
	}

	public boolean apply(Property property, boolean change) {
		return false;
	}

	public boolean apply(Alternation alternation, boolean change) {
		return false;
	}

	public boolean apply(Clause clause, boolean change) {
		return false;
	}

	public boolean apply(Variable variable, boolean change) {
		if (variable instanceof Parameter) return apply((Parameter) variable, change);
		if (variable instanceof Existential) return apply((Existential) variable, change);
		return false;
	}

	public boolean apply(Parameter parameter, boolean change) {
		return false;
	}

	public boolean apply(Existential existential, boolean change) {
		return false;
	}

	public boolean apply(Constraint constraint, boolean change) {
		if (constraint instanceof Equation) apply((Equation) constraint, change);
		if (constraint instanceof Inclusion) apply((Inclusion) constraint, change);
		if (constraint instanceof Boolean) apply((Boolean) constraint, change);
		return false;
	}

	public boolean apply(Equation equation, boolean change) {
		return false;
	}	

	public boolean apply(Boolean constraint, boolean change) {
		return false;
	}

	public boolean apply(Inclusion inclusion, boolean change) {
		return false;
	}

	public boolean apply(Expression expression, boolean change) {
		if (expression instanceof Operation) apply((Operation) expression, change);
		if (expression instanceof Constant) apply((Constant) expression, change);
		if (expression instanceof Reference) apply((Reference) expression, change);
		return false;
	}

	public boolean apply(Constant constant, boolean change) {
		return false;
	}

	public boolean apply(Reference reference, boolean change) {
		return false;
	}

	public boolean apply(Operation operation, boolean change) {
		if (operation instanceof UnaryOperation) apply((UnaryOperation) operation, change);
		if (operation instanceof BinaryOperation) apply((BinaryOperation) operation, change);
		if (operation instanceof MultiOperation) apply((MultiOperation) operation, change);
		return false;
	}

	public boolean apply(UnaryOperation operation, boolean change) {
		if (operation instanceof Negation) apply((Negation) operation, change);
		return false;
	}

	public boolean apply(BinaryOperation operation, boolean change) {
		if (operation instanceof Division) apply((Division) operation, change);
		if (operation instanceof Exponentiation) apply((Exponentiation) operation, change);
		return false;
	}

	public boolean apply(MultiOperation operation, boolean change) {
		if (operation instanceof Addition) apply((Addition) operation, change);
		if (operation instanceof Multiplication) apply((Multiplication) operation, change);
		return false;
	}

	public boolean apply(Addition addition, boolean change) {
		return false;
	}

	public boolean apply(Multiplication multiplication, boolean change) {
		return false;
	}

	public boolean apply(Negation negation, boolean change) {
		return false;
	}

	public boolean apply(Division division, boolean change) {
		return false;
	}

	public boolean apply(Exponentiation exponentiation, boolean change) {
		return false;
	}

}
